<?php
namespace app\admin\controller;
use think\Db;
use think\Session;


use think\Controller;
class Login extends Controller{
    public function index(){//显示登陆界面
        return $this->fetch();
    }
    public function check(){//登陆判断
        //接收表单值
        $username=input("post.username");
        $password=sha1(md5(input("post.password")));
        //echo $username."<br>".$password."<br>".sha1(md5(123456));die();
        $vcode=input("post.vcode");
        //判断验证码是否正确
        if(!captcha_check($vcode)){
        	$this->error("验证码错误！");
        }
        //判断用户名和密码组合是否错误
        if(Db::table('tb_admin')->where('username',$username)->where('password',$password)->find()){
        	session::set("info_admin",$username);
        	$this->error("登陆成功","Admin/index");
        }else{
        $this->error("用户名或密码错误！");
        }
}
}
?>